import {
	mapGetters
} from 'vuex';

export default {
	computed: {
		...mapGetters('m_cart', ['total'])
	},

	watch: {
		total() {
			this.setBadge();
		}
	},

	onShow() {
		// 页面展示时设置徽标
		this.setBadge();
	},

	data() {
		return {

		}
	},

	methods: {
		setBadge() {
			// 设置徽标
			uni.setTabBarBadge({
				index: 2, //索引
				text: this.total + ''
			})
		}
	}
}